/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-09-01 15:20:41
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-01-22 11:30:58
 * @FilePath: /yt-devops/lib/pages/devices/device_tab/device_detail/battery_pack_detail/battery_pack_detail_view.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/app_bar/app_bar_widget.dart';
import 'package:yt_devops/resources/resources.dart';
import 'package:yt_devops/routers/router_path.dart';
import 'package:yt_devops/styles/styles.dart';
import '../../../../../resources/str_res_keys.dart';
import 'battery_pack_detail_controller.dart';
import 'components/battery_cell_widget.dart';
import 'components/battery_pack_widget.dart';
import 'liquid_cluster_product_json.dart';

class BatteryPackDetailPage extends GetView<BatteryPackDetailController> {
  const BatteryPackDetailPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarWidget.withRightActions(controller.title, actions: [
        if (controller.hasRemoteSetting)
          GestureDetector(
            onTap: () {
              Get.toNamed(RouterPath.deviceControll, arguments: {
                'title': ResKey.parameterSets.tr,
                'deviceId': controller.deviceId,
                'page': liquid_cluster_product_json,
              });
            },
            child: Image.asset(ImageAssets.iconSetting),
          )
      ]),
      body: GetBuilder<BatteryPackDetailController>(
        builder: (controller) => Column(
          children: [
            BrnTabBar(
              controller: controller.tabController,
              tabs: controller.tabs,
              unselectedLabelStyle: TextStyles.f16,
              labelStyle: TextStyles.pf16.boldStyle,
              tabHeight: 45.h,
              indicatorWeight: 3,
            ),
            Expanded(
                child: TabBarView(
              controller: controller.tabController,
              children: [
                BatteryPackWidget(controller.deviceId, controller.productId,
                    controller.connectStatus),
                BatteryCellWidget(
                  key: controller.cellKey,
                  controller.selectedBatteryCell,
                  controller.productId,
                )
              ],
            ))
          ],
        ),
      ),
    );
  }
}
